package messangerTypes;

import java.util.Vector;

@SuppressWarnings("serial")
public class MultiCastAnouncement extends MessageBase implements java.io.Serializable
{

	private Vector<User> activeUsers = new Vector <User> ();
	
	public MultiCastAnouncement()
	{
		super(MessageType.MULTICAST_ANOUNCMENT);
	}
	
	@Override
	public String toString()
	{
		return "MultiCastAnouncement [activeUsers=" + activeUsers + "]";
	}

	public void addUser (User user)
	{
		this.activeUsers.add(user);
	}
	
	public boolean isMember (User user)
	{
		return this.activeUsers.contains(user);
	}
	
	//TODO: wow this is really inefficient...
	public void removeUser (User user)
	{
		for(int i = 0; i < this.activeUsers.size(); i++)
		{
			if(this.activeUsers.get(i).equals(user))
			{
				this.activeUsers.remove(i);
				break;
			}
			else
			{
				//continue searching
			}
		}
	}

	public Vector<User> getActiveUsers()
	{
		return activeUsers;
	}

}
